package com.ceres.crops.service.impl;

import com.ceres.crops.dao.PestMapper;
import com.ceres.crops.pojo.Pest;
import com.ceres.crops.service.PestService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class PestServiceImpl implements PestService {

    @Autowired
    private PestMapper pestMapper;

    //查询所有的病害虫
    @Override
    public List<Pest> findAll() {
        return pestMapper.selectAll();
    }

    //添加新增的病害虫
    @Override
    public void add(Pest pest) {
        pestMapper.insertSelective(pest);
    }

    //更新病害虫
    @Override
    public void update(Pest pest) {
        pestMapper.updateByPrimaryKey(pest);
    }
}
